package com.caisejingyu.whales.control.toast;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.view.View;

/**
 * IToastBuilder
 */
@SuppressWarnings({"all"})
public interface IToastBuilder {

    int ICON_TYPE_NONE = 0;// 没有图标
    int ICON_TYPE_OK = 1;//成功
    int ICON_TYPE_WARN = 2;//警告
    int ICON_TYPE_ERROR = 3;//错误

    IToastBuilder setIcon(Drawable drawable);

    /**
     * 设置图标类型，如果使用设置图标类型，则不需要再设置图标
     *
     * @param type 图标类型
     */
    IToastBuilder setIconType(int type);

    IToastBuilder setContent(CharSequence content);

    IToastBuilder setDuration(int duration);

    IToastBuilder setGravity(int gravity);

    /** 该Toast是否马上取消之前最后一个Toast */
    IToastBuilder cancelLast(boolean cancelLast);

    /**
     * 替换内容，复用Toast
     *
     * @param toastId Toast唯一标示，相同的id才会进行替换
     */
    IToastBuilder replace(String toastId, IToastAction replaceAction);

    IToastBuilder setView(@LayoutRes int layout, IToastAction initAction);

    void show(@NonNull Context context);

    interface IToastAction {
        void accept(View view);
    }
}
